<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="/js/layui/css/layui.css">
<style type="text/css">
#ztreeDiv {
	width: 100%;
	height: 100%;
	position: absolute;
	top: 0;
	left: 0;
	background-color: rgba(255, 255, 255, .5);
	display: none;
}

#ztree {
	width: 300px;
	margin: 30px auto;
	font-size: 1.2em;
}
</style>
</head>
<body>
	<div class="layui-col-lg8 layui-col-lg-offset2" style="margin-top: 1%">
		<span style="font-size: 2em; margin: 30px auto; display: block; text-align: center">新增角色</span>
		<form class="layui-form layui-form-pane" style="width: 80%; margin-left: 10%;"
			lay-filter="registerForm">
			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">角色名称</label>
				<div class="layui-input-block">
					<input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="角色名称"
						class="layui-input">
				</div>
			</div>
			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">角色KEY</label>
				<div class="layui-input-block">
					<input type="text" name="keyword" lay-verify="required" autocomplete="off" placeholder="角色KEY"
						class="layui-input">
				</div>
			</div>
			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">角色描述</label>
				<div class="layui-input-block">
					<input type="text" name="description" autocomplete="off" placeholder="角色描述" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block" style="text-align: center; margin-left: 0;">
					<a class="layui-btn" lay-submit="" lay-filter="formSubmit">提交</a>
				</div>
			</div>
		</form>
	</div>
</body>
<script type="text/javascript" src="/js/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="/js/commentUtils.js"></script>
<script type="text/javascript" src="/js/layui/layui.js"></script>
<script type="text/javascript">
	layui.use([ 'form' ], function() {
		var form = layui.form;
		form.on('submit(formSubmit)', function(data) {
			var postData = data.field;
			utils.postUrl("/sys/role", postData, function(res) {
				if (res.code == 0) {
					parent.layer.msg("添加成功!", function() {
						parent.layui.table.reload('roleTab');
						var index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);
					});
				} else {
					parent.layer.msg(res.msg, {
						icon : 2,
						anim : 6
					});
				}
			});
			return false;
		});
	});
</script>
</html>